<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

</head>

<body>
    <input type="text" name="" id="num" value="89719847">
    <button id="btn">计算</button>
    <input type="text" name="" id="num1">天
    <input type="text" name="" id="num2">时
    <input type="text" name="" id="num3">分
    <input type="text" name="" id="num4">秒
    <script>
        document.getElementById("btn").onclick = function() {
            //获取第一个数值
            var _num1 = Number(document.getElementById("num").value);
            //计算天数和小时和分钟
            // var
            //     a = parseInt(_num1 / 86400),

            //     b = parseInt(((_num1 / 86400) - a) * 24),
            //     c = parseInt((Number((_num1 / 86400) - a) * 24 - b) * 60),
            //     d = parseInt(((Number((Number((_num1 / 86400) - a) * 24 - b) * 60)) - c) * 60);
            // document.getElementById("num1").value = a;
            // document.getElementById("num2").value = b;
            // document.getElementById("num3").value = c;
            // document.getElementById("num4").value = d;
            var
            //天数
                a = parseInt(_num1 / 86400),
                b = parseInt((_num1 % 86400) / 3600),
                c = parseInt((_num1 % 86400 % 3600) / 60),
                d = parseInt((_num1 % 86400 % 3600 % 60) % 60);
            //3600为小时换算 c60为分换算 d60位秒换算所以取余；
            document.getElementById("num1").value = a;
            document.getElementById("num2").value = b;
            document.getElementById("num3").value = c;
            document.getElementById("num4").value = d;
        }
    </script>
</body>

</html>